<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the TableProjectAttachment class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single TableProjectAttachment object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a TableProjectAttachmentMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 * 
	 * @package My Application
	 * @subpackage MetaControls
	 * property-read TableProjectAttachment $TableProjectAttachment the actual TableProjectAttachment data class being edited
	 * property QLabel $IdControl
	 * property-read QLabel $IdLabel
	 * property QListBox $ProjectIdControl
	 * property-read QLabel $ProjectIdLabel
	 * property QTextBox $NameControl
	 * property-read QLabel $NameLabel
	 * property QTextBox $TypeControl
	 * property-read QLabel $TypeLabel
	 * property QIntegerTextBox $SizeControl
	 * property-read QLabel $SizeLabel
	 * property QTextBox $ContentsControl
	 * property-read QLabel $ContentsLabel
	 * property QTextBox $ContentsBase64Control
	 * property-read QLabel $ContentsBase64Label
	 * property QDateTimePicker $UploadDateControl
	 * property-read QLabel $UploadDateLabel
	 * property QDateTimePicker $DeleteDateControl
	 * property-read QLabel $DeleteDateLabel
	 * property QTextBox $DeletedControl
	 * property-read QLabel $DeletedLabel
	 * property QTextBox $MessageControl
	 * property-read QLabel $MessageLabel
	 * property QListBox $UserIdControl
	 * property-read QLabel $UserIdLabel
	 * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class TableProjectAttachmentMetaControlGen extends QBaseClass {
		// General Variables
		protected $objTableProjectAttachment;
		protected $objParentObject;
		protected $strTitleVerb;
		protected $blnEditMode;

		// Controls that allow the editing of TableProjectAttachment's individual data fields
		protected $lblId;
		protected $lstProject;
		protected $txtName;
		protected $txtType;
		protected $txtSize;
		protected $txtContents;
		protected $txtContentsBase64;
		protected $calUploadDate;
		protected $calDeleteDate;
		protected $txtDeleted;
		protected $txtMessage;
		protected $lstUser;

		// Controls that allow the viewing of TableProjectAttachment's individual data fields
		protected $lblProjectId;
		protected $lblName;
		protected $lblType;
		protected $lblSize;
		protected $lblContents;
		protected $lblContentsBase64;
		protected $lblUploadDate;
		protected $lblDeleteDate;
		protected $lblDeleted;
		protected $lblMessage;
		protected $lblUserId;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * TableProjectAttachmentMetaControl to edit a single TableProjectAttachment object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single TableProjectAttachment object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectAttachmentMetaControl
		 * @param TableProjectAttachment $objTableProjectAttachment new or existing TableProjectAttachment object
		 */
		 public function __construct($objParentObject, TableProjectAttachment $objTableProjectAttachment) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this TableProjectAttachmentMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked TableProjectAttachment object
			$this->objTableProjectAttachment = $objTableProjectAttachment;

			// Figure out if we're Editing or Creating New
			if ($this->objTableProjectAttachment->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
		 * edit, or if we are also allowed to create a new one, etc.
		 * 
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectAttachmentMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectAttachment object creation - defaults to CreateOrEdit
 		 * @return TableProjectAttachmentMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objTableProjectAttachment = TableProjectAttachment::Load($intId);

				// TableProjectAttachment was found -- return it!
				if ($objTableProjectAttachment)
					return new TableProjectAttachmentMetaControl($objParentObject, $objTableProjectAttachment);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a TableProjectAttachment object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new TableProjectAttachmentMetaControl($objParentObject, new TableProjectAttachment());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectAttachmentMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectAttachment object creation - defaults to CreateOrEdit
		 * @return TableProjectAttachmentMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return TableProjectAttachmentMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectAttachmentMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectAttachment object creation - defaults to CreateOrEdit
		 * @return TableProjectAttachmentMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return TableProjectAttachmentMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objTableProjectAttachment->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QListBox lstProject
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstProject_Create($strControlId = null) {
			$this->lstProject = new QListBox($this->objParentObject, $strControlId);
			$this->lstProject->Name = QApplication::Translate('Project');
			$this->lstProject->Required = true;
			if (!$this->blnEditMode)
				$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
			$objProjectArray = TableProject::LoadAll();
			if ($objProjectArray) foreach ($objProjectArray as $objProject) {
				$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
				if (($this->objTableProjectAttachment->Project) && ($this->objTableProjectAttachment->Project->Id == $objProject->Id))
					$objListItem->Selected = true;
				$this->lstProject->AddItem($objListItem);
			}
			return $this->lstProject;
		}

		/**
		 * Create and setup QLabel lblProjectId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblProjectId_Create($strControlId = null) {
			$this->lblProjectId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProjectId->Name = QApplication::Translate('Project');
			$this->lblProjectId->Text = ($this->objTableProjectAttachment->Project) ? $this->objTableProjectAttachment->Project->__toString() : null;
			$this->lblProjectId->Required = true;
			return $this->lblProjectId;
		}

		/**
		 * Create and setup QTextBox txtName
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtName_Create($strControlId = null) {
			$this->txtName = new QTextBox($this->objParentObject, $strControlId);
			$this->txtName->Name = QApplication::Translate('Name');
			$this->txtName->Text = $this->objTableProjectAttachment->Name;
			$this->txtName->Required = true;
			$this->txtName->MaxLength = TableProjectAttachment::NameMaxLength;
			return $this->txtName;
		}

		/**
		 * Create and setup QLabel lblName
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblName_Create($strControlId = null) {
			$this->lblName = new QLabel($this->objParentObject, $strControlId);
			$this->lblName->Name = QApplication::Translate('Name');
			$this->lblName->Text = $this->objTableProjectAttachment->Name;
			$this->lblName->Required = true;
			return $this->lblName;
		}

		/**
		 * Create and setup QTextBox txtType
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtType_Create($strControlId = null) {
			$this->txtType = new QTextBox($this->objParentObject, $strControlId);
			$this->txtType->Name = QApplication::Translate('Type');
			$this->txtType->Text = $this->objTableProjectAttachment->Type;
			$this->txtType->Required = true;
			$this->txtType->MaxLength = TableProjectAttachment::TypeMaxLength;
			return $this->txtType;
		}

		/**
		 * Create and setup QLabel lblType
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblType_Create($strControlId = null) {
			$this->lblType = new QLabel($this->objParentObject, $strControlId);
			$this->lblType->Name = QApplication::Translate('Type');
			$this->lblType->Text = $this->objTableProjectAttachment->Type;
			$this->lblType->Required = true;
			return $this->lblType;
		}

		/**
		 * Create and setup QIntegerTextBox txtSize
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtSize_Create($strControlId = null) {
			$this->txtSize = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtSize->Name = QApplication::Translate('Size');
			$this->txtSize->Text = $this->objTableProjectAttachment->Size;
			$this->txtSize->Required = true;
			return $this->txtSize;
		}

		/**
		 * Create and setup QLabel lblSize
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblSize_Create($strControlId = null, $strFormat = null) {
			$this->lblSize = new QLabel($this->objParentObject, $strControlId);
			$this->lblSize->Name = QApplication::Translate('Size');
			$this->lblSize->Text = $this->objTableProjectAttachment->Size;
			$this->lblSize->Required = true;
			$this->lblSize->Format = $strFormat;
			return $this->lblSize;
		}

		/**
		 * Create and setup QTextBox txtContents
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtContents_Create($strControlId = null) {
			$this->txtContents = new QTextBox($this->objParentObject, $strControlId);
			$this->txtContents->Name = QApplication::Translate('Contents');
			$this->txtContents->Text = $this->objTableProjectAttachment->Contents;
			$this->txtContents->TextMode = QTextMode::MultiLine;
			return $this->txtContents;
		}

		/**
		 * Create and setup QLabel lblContents
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblContents_Create($strControlId = null) {
			$this->lblContents = new QLabel($this->objParentObject, $strControlId);
			$this->lblContents->Name = QApplication::Translate('Contents');
			$this->lblContents->Text = $this->objTableProjectAttachment->Contents;
			return $this->lblContents;
		}

		/**
		 * Create and setup QTextBox txtContentsBase64
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtContentsBase64_Create($strControlId = null) {
			$this->txtContentsBase64 = new QTextBox($this->objParentObject, $strControlId);
			$this->txtContentsBase64->Name = QApplication::Translate('Contents Base 64');
			$this->txtContentsBase64->Text = $this->objTableProjectAttachment->ContentsBase64;
			$this->txtContentsBase64->TextMode = QTextMode::MultiLine;
			return $this->txtContentsBase64;
		}

		/**
		 * Create and setup QLabel lblContentsBase64
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblContentsBase64_Create($strControlId = null) {
			$this->lblContentsBase64 = new QLabel($this->objParentObject, $strControlId);
			$this->lblContentsBase64->Name = QApplication::Translate('Contents Base 64');
			$this->lblContentsBase64->Text = $this->objTableProjectAttachment->ContentsBase64;
			return $this->lblContentsBase64;
		}

		/**
		 * Create and setup QDateTimePicker calUploadDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calUploadDate_Create($strControlId = null) {
			$this->calUploadDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calUploadDate->Name = QApplication::Translate('Upload Date');
			$this->calUploadDate->DateTime = $this->objTableProjectAttachment->UploadDate;
			$this->calUploadDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calUploadDate;
		}

		/**
		 * Create and setup QLabel lblUploadDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblUploadDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblUploadDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblUploadDate->Name = QApplication::Translate('Upload Date');
			$this->strUploadDateDateTimeFormat = $strDateTimeFormat;
			$this->lblUploadDate->Text = sprintf($this->objTableProjectAttachment->UploadDate) ? $this->objTableProjectAttachment->UploadDate->__toString($this->strUploadDateDateTimeFormat) : null;
			return $this->lblUploadDate;
		}

		protected $strUploadDateDateTimeFormat;


		/**
		 * Create and setup QDateTimePicker calDeleteDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calDeleteDate_Create($strControlId = null) {
			$this->calDeleteDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calDeleteDate->Name = QApplication::Translate('Delete Date');
			$this->calDeleteDate->DateTime = $this->objTableProjectAttachment->DeleteDate;
			$this->calDeleteDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calDeleteDate;
		}

		/**
		 * Create and setup QLabel lblDeleteDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblDeleteDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblDeleteDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblDeleteDate->Name = QApplication::Translate('Delete Date');
			$this->strDeleteDateDateTimeFormat = $strDateTimeFormat;
			$this->lblDeleteDate->Text = sprintf($this->objTableProjectAttachment->DeleteDate) ? $this->objTableProjectAttachment->DeleteDate->__toString($this->strDeleteDateDateTimeFormat) : null;
			return $this->lblDeleteDate;
		}

		protected $strDeleteDateDateTimeFormat;


		/**
		 * Create and setup QTextBox txtDeleted
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtDeleted_Create($strControlId = null) {
			$this->txtDeleted = new QTextBox($this->objParentObject, $strControlId);
			$this->txtDeleted->Name = QApplication::Translate('Deleted');
			$this->txtDeleted->Text = $this->objTableProjectAttachment->Deleted;
			$this->txtDeleted->Required = true;
			$this->txtDeleted->MaxLength = TableProjectAttachment::DeletedMaxLength;
			return $this->txtDeleted;
		}

		/**
		 * Create and setup QLabel lblDeleted
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblDeleted_Create($strControlId = null) {
			$this->lblDeleted = new QLabel($this->objParentObject, $strControlId);
			$this->lblDeleted->Name = QApplication::Translate('Deleted');
			$this->lblDeleted->Text = $this->objTableProjectAttachment->Deleted;
			$this->lblDeleted->Required = true;
			return $this->lblDeleted;
		}

		/**
		 * Create and setup QTextBox txtMessage
		 * @param string $strControlId optional ControlId to use
		 * @return QTextBox
		 */
		public function txtMessage_Create($strControlId = null) {
			$this->txtMessage = new QTextBox($this->objParentObject, $strControlId);
			$this->txtMessage->Name = QApplication::Translate('Message');
			$this->txtMessage->Text = $this->objTableProjectAttachment->Message;
			$this->txtMessage->TextMode = QTextMode::MultiLine;
			return $this->txtMessage;
		}

		/**
		 * Create and setup QLabel lblMessage
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblMessage_Create($strControlId = null) {
			$this->lblMessage = new QLabel($this->objParentObject, $strControlId);
			$this->lblMessage->Name = QApplication::Translate('Message');
			$this->lblMessage->Text = $this->objTableProjectAttachment->Message;
			return $this->lblMessage;
		}

		/**
		 * Create and setup QListBox lstUser
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstUser_Create($strControlId = null) {
			$this->lstUser = new QListBox($this->objParentObject, $strControlId);
			$this->lstUser->Name = QApplication::Translate('User');
			$this->lstUser->Required = true;
			if (!$this->blnEditMode)
				$this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
			$objUserArray = TableUserProject::LoadAll();
			if ($objUserArray) foreach ($objUserArray as $objUser) {
				$objListItem = new QListItem($objUser->__toString(), $objUser->Id);
				if (($this->objTableProjectAttachment->User) && ($this->objTableProjectAttachment->User->Id == $objUser->Id))
					$objListItem->Selected = true;
				$this->lstUser->AddItem($objListItem);
			}
			return $this->lstUser;
		}

		/**
		 * Create and setup QLabel lblUserId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblUserId_Create($strControlId = null) {
			$this->lblUserId = new QLabel($this->objParentObject, $strControlId);
			$this->lblUserId->Name = QApplication::Translate('User');
			$this->lblUserId->Text = ($this->objTableProjectAttachment->User) ? $this->objTableProjectAttachment->User->__toString() : null;
			$this->lblUserId->Required = true;
			return $this->lblUserId;
		}



		/**
		 * Refresh this MetaControl with Data from the local TableProjectAttachment object.
		 * @param boolean $blnReload reload TableProjectAttachment from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objTableProjectAttachment->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objTableProjectAttachment->Id;

			if ($this->lstProject) {
					$this->lstProject->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
				$objProjectArray = TableProject::LoadAll();
				if ($objProjectArray) foreach ($objProjectArray as $objProject) {
					$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
					if (($this->objTableProjectAttachment->Project) && ($this->objTableProjectAttachment->Project->Id == $objProject->Id))
						$objListItem->Selected = true;
					$this->lstProject->AddItem($objListItem);
				}
			}
			if ($this->lblProjectId) $this->lblProjectId->Text = ($this->objTableProjectAttachment->Project) ? $this->objTableProjectAttachment->Project->__toString() : null;

			if ($this->txtName) $this->txtName->Text = $this->objTableProjectAttachment->Name;
			if ($this->lblName) $this->lblName->Text = $this->objTableProjectAttachment->Name;

			if ($this->txtType) $this->txtType->Text = $this->objTableProjectAttachment->Type;
			if ($this->lblType) $this->lblType->Text = $this->objTableProjectAttachment->Type;

			if ($this->txtSize) $this->txtSize->Text = $this->objTableProjectAttachment->Size;
			if ($this->lblSize) $this->lblSize->Text = $this->objTableProjectAttachment->Size;

			if ($this->txtContents) $this->txtContents->Text = $this->objTableProjectAttachment->Contents;
			if ($this->lblContents) $this->lblContents->Text = $this->objTableProjectAttachment->Contents;

			if ($this->txtContentsBase64) $this->txtContentsBase64->Text = $this->objTableProjectAttachment->ContentsBase64;
			if ($this->lblContentsBase64) $this->lblContentsBase64->Text = $this->objTableProjectAttachment->ContentsBase64;

			if ($this->calUploadDate) $this->calUploadDate->DateTime = $this->objTableProjectAttachment->UploadDate;
			if ($this->lblUploadDate) $this->lblUploadDate->Text = sprintf($this->objTableProjectAttachment->UploadDate) ? $this->objTableProjectAttachment->UploadDate->__toString($this->strUploadDateDateTimeFormat) : null;

			if ($this->calDeleteDate) $this->calDeleteDate->DateTime = $this->objTableProjectAttachment->DeleteDate;
			if ($this->lblDeleteDate) $this->lblDeleteDate->Text = sprintf($this->objTableProjectAttachment->DeleteDate) ? $this->objTableProjectAttachment->DeleteDate->__toString($this->strDeleteDateDateTimeFormat) : null;

			if ($this->txtDeleted) $this->txtDeleted->Text = $this->objTableProjectAttachment->Deleted;
			if ($this->lblDeleted) $this->lblDeleted->Text = $this->objTableProjectAttachment->Deleted;

			if ($this->txtMessage) $this->txtMessage->Text = $this->objTableProjectAttachment->Message;
			if ($this->lblMessage) $this->lblMessage->Text = $this->objTableProjectAttachment->Message;

			if ($this->lstUser) {
					$this->lstUser->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstUser->AddItem(QApplication::Translate('- Select One -'), null);
				$objUserArray = TableUserProject::LoadAll();
				if ($objUserArray) foreach ($objUserArray as $objUser) {
					$objListItem = new QListItem($objUser->__toString(), $objUser->Id);
					if (($this->objTableProjectAttachment->User) && ($this->objTableProjectAttachment->User->Id == $objUser->Id))
						$objListItem->Selected = true;
					$this->lstUser->AddItem($objListItem);
				}
			}
			if ($this->lblUserId) $this->lblUserId->Text = ($this->objTableProjectAttachment->User) ? $this->objTableProjectAttachment->User->__toString() : null;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC TABLEPROJECTATTACHMENT OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's TableProjectAttachment instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveTableProjectAttachment() {
			try {
				// Update any fields for controls that have been created
				if ($this->lstProject) $this->objTableProjectAttachment->ProjectId = $this->lstProject->SelectedValue;
				if ($this->txtName) $this->objTableProjectAttachment->Name = $this->txtName->Text;
				if ($this->txtType) $this->objTableProjectAttachment->Type = $this->txtType->Text;
				if ($this->txtSize) $this->objTableProjectAttachment->Size = $this->txtSize->Text;
				if ($this->txtContents) $this->objTableProjectAttachment->Contents = $this->txtContents->Text;
				if ($this->txtContentsBase64) $this->objTableProjectAttachment->ContentsBase64 = $this->txtContentsBase64->Text;
				if ($this->calUploadDate) $this->objTableProjectAttachment->UploadDate = $this->calUploadDate->DateTime;
				if ($this->calDeleteDate) $this->objTableProjectAttachment->DeleteDate = $this->calDeleteDate->DateTime;
				if ($this->txtDeleted) $this->objTableProjectAttachment->Deleted = $this->txtDeleted->Text;
				if ($this->txtMessage) $this->objTableProjectAttachment->Message = $this->txtMessage->Text;
				if ($this->lstUser) $this->objTableProjectAttachment->UserId = $this->lstUser->SelectedValue;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the TableProjectAttachment object
				$this->objTableProjectAttachment->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's TableProjectAttachment instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteTableProjectAttachment() {
			$this->objTableProjectAttachment->Delete();
		}		



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'TableProjectAttachment': return $this->objTableProjectAttachment;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to TableProjectAttachment fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'ProjectIdControl':
					if (!$this->lstProject) return $this->lstProject_Create();
					return $this->lstProject;
				case 'ProjectIdLabel':
					if (!$this->lblProjectId) return $this->lblProjectId_Create();
					return $this->lblProjectId;
				case 'NameControl':
					if (!$this->txtName) return $this->txtName_Create();
					return $this->txtName;
				case 'NameLabel':
					if (!$this->lblName) return $this->lblName_Create();
					return $this->lblName;
				case 'TypeControl':
					if (!$this->txtType) return $this->txtType_Create();
					return $this->txtType;
				case 'TypeLabel':
					if (!$this->lblType) return $this->lblType_Create();
					return $this->lblType;
				case 'SizeControl':
					if (!$this->txtSize) return $this->txtSize_Create();
					return $this->txtSize;
				case 'SizeLabel':
					if (!$this->lblSize) return $this->lblSize_Create();
					return $this->lblSize;
				case 'ContentsControl':
					if (!$this->txtContents) return $this->txtContents_Create();
					return $this->txtContents;
				case 'ContentsLabel':
					if (!$this->lblContents) return $this->lblContents_Create();
					return $this->lblContents;
				case 'ContentsBase64Control':
					if (!$this->txtContentsBase64) return $this->txtContentsBase64_Create();
					return $this->txtContentsBase64;
				case 'ContentsBase64Label':
					if (!$this->lblContentsBase64) return $this->lblContentsBase64_Create();
					return $this->lblContentsBase64;
				case 'UploadDateControl':
					if (!$this->calUploadDate) return $this->calUploadDate_Create();
					return $this->calUploadDate;
				case 'UploadDateLabel':
					if (!$this->lblUploadDate) return $this->lblUploadDate_Create();
					return $this->lblUploadDate;
				case 'DeleteDateControl':
					if (!$this->calDeleteDate) return $this->calDeleteDate_Create();
					return $this->calDeleteDate;
				case 'DeleteDateLabel':
					if (!$this->lblDeleteDate) return $this->lblDeleteDate_Create();
					return $this->lblDeleteDate;
				case 'DeletedControl':
					if (!$this->txtDeleted) return $this->txtDeleted_Create();
					return $this->txtDeleted;
				case 'DeletedLabel':
					if (!$this->lblDeleted) return $this->lblDeleted_Create();
					return $this->lblDeleted;
				case 'MessageControl':
					if (!$this->txtMessage) return $this->txtMessage_Create();
					return $this->txtMessage;
				case 'MessageLabel':
					if (!$this->lblMessage) return $this->lblMessage_Create();
					return $this->lblMessage;
				case 'UserIdControl':
					if (!$this->lstUser) return $this->lstUser_Create();
					return $this->lstUser;
				case 'UserIdLabel':
					if (!$this->lblUserId) return $this->lblUserId_Create();
					return $this->lblUserId;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to TableProjectAttachment fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'ProjectIdControl':
						return ($this->lstProject = QType::Cast($mixValue, 'QControl'));
					case 'NameControl':
						return ($this->txtName = QType::Cast($mixValue, 'QControl'));
					case 'TypeControl':
						return ($this->txtType = QType::Cast($mixValue, 'QControl'));
					case 'SizeControl':
						return ($this->txtSize = QType::Cast($mixValue, 'QControl'));
					case 'ContentsControl':
						return ($this->txtContents = QType::Cast($mixValue, 'QControl'));
					case 'ContentsBase64Control':
						return ($this->txtContentsBase64 = QType::Cast($mixValue, 'QControl'));
					case 'UploadDateControl':
						return ($this->calUploadDate = QType::Cast($mixValue, 'QControl'));
					case 'DeleteDateControl':
						return ($this->calDeleteDate = QType::Cast($mixValue, 'QControl'));
					case 'DeletedControl':
						return ($this->txtDeleted = QType::Cast($mixValue, 'QControl'));
					case 'MessageControl':
						return ($this->txtMessage = QType::Cast($mixValue, 'QControl'));
					case 'UserIdControl':
						return ($this->lstUser = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>